﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace TestAttribute
{
    /// <summary>
    /// 网络消息
    /// </summary>
    public struct NetMsg
    {
        /// <summary>
        /// 消息号
        /// </summary>
        public int msgId;
        /// <summary>
        /// 网络数据
        /// </summary>
        public byte[] data;
    }

    /// <summary>
    /// 网络消息中心
    /// </summary>
    class MessageCenter
    {
        [Execute(100)]
        public void OnLoginRes(NetMsg args)
        {
            Console.WriteLine(string.Format("MsgId:{0} OnLoginRes:{1}",args.msgId, System.Text.Encoding.UTF8.GetString(args.data)));
        }

        [Execute(101)]
        public void OnRoleDataNtf(NetMsg args)
        {
            Console.WriteLine(string.Format("MsgId:{0} OnRoleDataNtf:{1}", args.msgId, System.Text.Encoding.UTF8.GetString(args.data)));
        }

        [Execute(102)]
        public void OnRoleDeleteRes(NetMsg args)
        {
            Console.WriteLine(string.Format("MsgId:{0} OnRoleDeleteRes:{1}", args.msgId, System.Text.Encoding.UTF8.GetString(args.data)));
        }

        [Execute(103)]
        public void OnROleLevelUpNtf(NetMsg args)
        {
            Console.WriteLine(string.Format("MsgId:{0} OnRoleLevelUpNtf:{1}", args.msgId, System.Text.Encoding.UTF8.GetString(args.data)));
        }

        [Execute(199)]
        public void OnLoginOut(NetMsg args)
        {
            Console.WriteLine(string.Format("MsgId:{0} OnLoginOut:{1}", args.msgId, System.Text.Encoding.UTF8.GetString(args.data)));
        }
    }
}
